package person.xjl.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes;
import person.xjl.domain.Teacher;
import person.xjl.service.TeacherService;

import java.util.List;

@Controller
@RequestMapping("Teacher")
public class TeacherController {
    @Autowired
    private TeacherService teacherServiceImpl;
    @RequestMapping("list.do")
    public String list(@RequestParam(value = "page",defaultValue = "1") int page, Model model){
        PageHelper.startPage(page,10);
        List<Teacher> teachers=teacherServiceImpl.list();
        PageInfo pageInfo=new PageInfo(teachers);
        model.addAttribute("pageInfo",pageInfo);
        return "teacher/listTeachers";
    }
}
